package com.ds.infrastructure.hyperspace.console.model.request.environment;

import com.ds.infrastructure.hyperspace.console.entity.enums.TbPublicEnum;
import com.ds.infrastructure.hyperspace.console.entity.table.TbEnvironment;
import com.ds.infrastructure.hyperspace.console.model.request.form.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * @author: yaozhendong
 * @create: 2019-09-18 11:45
 **/
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ListEnvironmentForm extends PageForm {

    private Long parentId;

    private String environmentName;

    public static TbEnvironment toEntity(ListEnvironmentForm form) {
        TbEnvironment tbEnvironment = new TbEnvironment();
        tbEnvironment.setParentId(form.getParentId());
        tbEnvironment.setEnvironmentName(form.getEnvironmentName());
        tbEnvironment.setGmtIsDeleted(TbPublicEnum.GMD_IS_DEL.NO.code);
        return tbEnvironment;
    }
}
